﻿@{
    ViewBag.Title = "更新部门";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>更新部门</h2>
<input type="text" readonly="readonly" id="id" />
<input placeholder="部门名称。长度限制为1~64个字节，字符不能包括\:*?'<>|'" id="name" />
<input placeholder="父亲部门id。根部门id为1" id="parentid" />
<input placeholder="在父部门中的次序值。order值小的排序靠前" id="order" />
<input type="button" onclick="submit()" value="更新" />
@Html.Hidden("deptId", (string)ViewBag.DeptId)
<script src="~/Scripts/jquery-1.8.2.min.js"></script>
<script type="text/javascript">
    $(function () {
        $("#id").val($("#deptId").val());
    });
    function submit() {
        var name = $("#name").val();
        var parentId = $("#parentid").val();
        var order = $("#order").val();
        var id = $("#id").val();
        $.ajax({
            url: "/Department/Add",
            data:{"id":id,"name":name,"parentId":parentId,"order":order},
            type: "Post",
            success: function (res) {
                alert(res);
                window.location.href = "/Department/List";
            }
        });
    }
</script>